/******************************************************************************* * Copyright (c) 2012, Project: FP7-ICT-257930 Aniketos * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * * - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * - Neither the name of institution nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ******************************************************************************/ /** */ package eu.aniketos.mtm.srs.impl; import eu.aniketos.mtm.srs.GoalSetType; import eu.aniketos.mtm.srs.MultiplicityType; import eu.aniketos.mtm.srs.RedType; import eu.aniketos.mtm.srs.SrsPackage; import eu.aniketos.mtm.srs.TypeType; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.notify.NotificationChain; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.emf.ecore.impl.EObjectImpl; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Red Type</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link eu.aniketos.mtm.srs.impl.RedTypeImpl#getGoalSet <em>Goal Set</em>}</li> * <li>{@link eu.aniketos.mtm.srs.impl.RedTypeImpl#getMultiplicity <em>Multiplicity</em>}</li> * <li>{@link eu.aniketos.mtm.srs.impl.RedTypeImpl#getType <em>Type</em>}</li> * </ul> * </p> * * @generated */ public class RedTypeImpl extends EObjectImpl implements RedType { /** * The cached value of the '{@link #getGoalSet() <em>Goal Set</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getGoalSet() * @generated * @ordered */ protected GoalSetType goalSet; /** * The default value of the '{@link #getMultiplicity() <em>Multiplicity</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getMultiplicity() * @generated * @ordered */ protected static final MultiplicityType MULTIPLICITY_EDEFAULT = MultiplicityType.SINGLE_ACTOR; /** * The cached value of the '{@link #getMultiplicity() <em>Multiplicity</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getMultiplicity() * @generated * @ordered */ protected MultiplicityType multiplicity = MULTIPLICITY_EDEFAULT; /** * This is true if the Multiplicity attribute has been set. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ protected boolean multiplicityESet; /** * The default value of the '{@link #getType() <em>Type</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getType() * @generated * @ordered */ protected static final TypeType TYPE_EDEFAULT = TypeType.FALLBACK; /** * The cached value of the '{@link #getType() <em>Type</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getType() * @generated * @ordered */ protected TypeType type = TYPE_EDEFAULT; /** * This is true if the Type attribute has been set. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ protected boolean typeESet; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected RedTypeImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return SrsPackage.Literals.RED_TYPE; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public GoalSetType getGoalSet() { return goalSet; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetGoalSet(GoalSetType newGoalSet, NotificationChain msgs) { GoalSetType oldGoalSet = goalSet; goalSet = newGoalSet; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SrsPackage.RED_TYPE__GOAL_SET, oldGoalSet, newGoalSet); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setGoalSet(GoalSetType newGoalSet) { if (newGoalSet != goalSet) { NotificationChain msgs = null; if (goalSet != null) msgs = ((InternalEObject)goalSet).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SrsPackage.RED_TYPE__GOAL_SET, null, msgs); if (newGoalSet != null) msgs = ((InternalEObject)newGoalSet).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SrsPackage.RED_TYPE__GOAL_SET, null, msgs); msgs = basicSetGoalSet(newGoalSet, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, SrsPackage.RED_TYPE__GOAL_SET, newGoalSet, newGoalSet)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public MultiplicityType getMultiplicity() { return multiplicity; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setMultiplicity(MultiplicityType newMultiplicity) { MultiplicityType oldMultiplicity = multiplicity; multiplicity = newMultiplicity == null ? MULTIPLICITY_EDEFAULT : newMultiplicity; boolean oldMultiplicityESet = multiplicityESet; multiplicityESet = true; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, SrsPackage.RED_TYPE__MULTIPLICITY, oldMultiplicity, multiplicity, !oldMultiplicityESet)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void unsetMultiplicity() { MultiplicityType oldMultiplicity = multiplicity; boolean oldMultiplicityESet = multiplicityESet; multiplicity = MULTIPLICITY_EDEFAULT; multiplicityESet = false; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.UNSET, SrsPackage.RED_TYPE__MULTIPLICITY, oldMultiplicity, MULTIPLICITY_EDEFAULT, oldMultiplicityESet)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean isSetMultiplicity() { return multiplicityESet; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public TypeType getType() { return type; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setType(TypeType newType) { TypeType oldType = type; type = newType == null ? TYPE_EDEFAULT : newType; boolean oldTypeESet = typeESet; typeESet = true; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, SrsPackage.RED_TYPE__TYPE, oldType, type, !oldTypeESet)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void unsetType() { TypeType oldType = type; boolean oldTypeESet = typeESet; type = TYPE_EDEFAULT; typeESet = false; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.UNSET, SrsPackage.RED_TYPE__TYPE, oldType, TYPE_EDEFAULT, oldTypeESet)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean isSetType() { return typeESet; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case SrsPackage.RED_TYPE__GOAL_SET: return basicSetGoalSet(null, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case SrsPackage.RED_TYPE__GOAL_SET: return getGoalSet(); case SrsPackage.RED_TYPE__MULTIPLICITY: return getMultiplicity(); case SrsPackage.RED_TYPE__TYPE: return getType(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case SrsPackage.RED_TYPE__GOAL_SET: setGoalSet((GoalSetType)newValue); return; case SrsPackage.RED_TYPE__MULTIPLICITY: setMultiplicity((MultiplicityType)newValue); return; case SrsPackage.RED_TYPE__TYPE: setType((TypeType)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case SrsPackage.RED_TYPE__GOAL_SET: setGoalSet((GoalSetType)null); return; case SrsPackage.RED_TYPE__MULTIPLICITY: unsetMultiplicity(); return; case SrsPackage.RED_TYPE__TYPE: unsetType(); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case SrsPackage.RED_TYPE__GOAL_SET: return goalSet != null; case SrsPackage.RED_TYPE__MULTIPLICITY: return isSetMultiplicity(); case SrsPackage.RED_TYPE__TYPE: return isSetType(); } return super.eIsSet(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { if (eIsProxy()) return super.toString(); StringBuffer result = new StringBuffer(super.toString()); result.append(" (multiplicity: "); if (multiplicityESet) result.append(multiplicity); else result.append("<unset>"); result.append(", type: "); if (typeESet) result.append(type); else result.append("<unset>"); result.append(')'); return result.toString(); } } //RedTypeImpl